package com.ysz.timewheel.server.struct;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @ClassName ClientStruct
 * @Description 定义客户端结构体
 * @Data 16:02
 * @Version 1.0
 * @Author ysz
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ClientStruct {

    /**
     * 客户端ip
     */
    private String ip;

    /**
     * 处理任务的线程
     */
    private Thread thread;

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        ClientStruct that = (ClientStruct) object;
        return Objects.equals(ip, that.ip);
    }

    @Override
    public int hashCode() {
        return Objects.hash(ip);
    }
}
